﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2_NovaAdmin.Application.Services
{
    [Authorize]
    public class DemoService : IDynamicController
    {
        private readonly IRepository<_3_NovaAdmin.Domain.Entities.User> _userRepository;
        private readonly ICompositeRepository<_3_NovaAdmin.Domain.Entities.GroupMember> _groupMemberRepository;
        private readonly IUnitOfWork _unitOfWork;
        public DemoService(IRepository<_3_NovaAdmin.Domain.Entities.User> userRepository, IUnitOfWork unitOfWork, ICompositeRepository<_3_NovaAdmin.Domain.Entities.GroupMember> groupMemberRepository)
        {
            _userRepository = userRepository;
            _groupMemberRepository = groupMemberRepository;
            _unitOfWork = unitOfWork;
        }

        public async Task<ApiResult> test1()
        {
            await _userRepository.InsertSingleData(new _3_NovaAdmin.Domain.Entities.User
            {
                UserName = "王琪",
                Email = "111",
                Password = "222"
            });

            await _groupMemberRepository.InsertSingleData(new GroupMember(Guid.NewGuid(), Guid.NewGuid()));
            await _unitOfWork.SaveChangesAsync();
            return ApiResult.Ok();
        }
    }
}
